const express = require('express');
const userRouter = require('./routes/user');
const taskRouter = require('./routes/task');
const cors = require('cors');

const app = express();

app.use(express.json());
app.use(cors());

//userRouter路由,
//登录http://localhost:3080/user/login
//注册http://localhost:3080/user/register
app.use('/user',userRouter);

//taskRouter路由
//任务http://localhost:3080/task
app.use('/task',taskRouter);

app.get('/', (req, res) => {
  res.send('Hello World');
});

app.listen(3080, () => {
  console.log('Server is running on port 3080 ......');
});